﻿import com.dmotiko.mirador.*
import com.dmotiko.general.*
import mx.transitions.*;
import mx.transitions.easing.*;
import mx.utils.Delegate;

class MiradorBack
extends BaseClip {
	
	private var mcBlack:MovieClip;
	private var tFade:Tween;
	private var mcShadow:MovieClip;
	
	private function initClip():Void {
		MiradorSite.getApp().addEventListener( WebSite.SECTION_CHANGED, Delegate.create( this, section_changed ));
		mcBlack._alpha = 100;
		mcShadow._alpha = 0;
		section_changed( { section: MiradorSite.getApp().getSection() } );
	}
	
	private function section_changed( evnt ):Void {
		if ( evnt.section == MiradorSite.HOME || evnt.section == MiradorSite.COMUNIQUESE || evnt.section == MiradorSite.UBICACION ) {
			mcBlack._alpha = 100;
			/*
			if (tFade) tFade.stop();
			tFade = new Tween( mcBlack, "_alpha", Regular.easeOut, mcBlack._alpha, 100, 0.5, true);
			*/		
		} else {
			if ( evnt.section != MiradorSite.PREHOME && evnt.section != MiradorSite.HOME) {
				mcShadow._alpha = 100;/*registerTween("shadowFade", new Tween(mcShadow, "_alpha", Regular.easeOut, mcShadow._alpha, 100, 0.5, true));*/
			}
			/*
			if (tFade) tFade.stop();
			tFade = new Tween( mcBlack, "_alpha", Regular.easeOut, mcBlack._alpha, 0, 0.5, true);
			*/
			mcBlack._alpha = 0;
		}
		
	}
	
}